using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using UserSystem.Model;

namespace AndroidUsersystemService.Controllers
{
    [Produces("application/json")]
    [Route("api/RegUser")]
    public class RegUserController : Controller
    {
        [HttpPost]
        public JObject Post([FromBody]RegUserFromClient client)
        {
            JObject jResult = new JObject();
            string msg;
            RegUserToClient modelresult = UserSystem.BLL.RegUserManage.RegUser(client, out msg);
            if (modelresult == null)
            {
                jResult.Add("data", "");
                jResult.Add("msg", "");
            }
            else
            {
                JObject jData = new JObject();
                jData.Add("userName", modelresult.userName);
                jData.Add("token", modelresult.token);
                jResult.Add("data", jData);
                jResult.Add("msg", msg);
            }
            return jResult;
        }
    }
}